{"ast":null,"code":"export const REQUIRED_FIELD = 'Обязательно для заполнения';\nconst reg = /\\.[a-zа-я]{1,10}$/i;\nexport const emailValidation = {\n  required: REQUIRED_FIELD,\n  validate: value => {\n    if (value.length < 4 || value.length > 128) {\n      return 'Эл. адрес должен быть от 4 до 128 символов';\n    }\n    if (!reg.test(value)) {\n      return 'Эл. адрес должен иметь тип: \"example@example.com\"';\n    }\n    return true;\n  }\n};\nexport const nicknameValidation = {\n  required: REQUIRED_FIELD,\n  validate: value => {\n    if (value.length < 2 || value.length > 30) {\n      return 'Псевдоним должен быть от 2 до 30 символов';\n    }\n    return true;\n  }\n};\nexport const nicknameChangeValidation = {\n  validate: value => {\n    if (value) {\n      if (value && value.length !== 0 || value.length < 2 || value.length > 30) {\n        return 'Псевдоним должен быть от 2 до 30 символов';\n      }\n    }\n    return true;\n  }\n};\nexport const passwordValidation = {\n  required: REQUIRED_FIELD,\n  validate: value => {\n    if (value.length < 8) {\n      return 'Пароль должен быть длиннее 8 символов';\n    }\n    return true;\n  }\n};\nexport const confirmPassword = (firstValue, secondValue) => {\n  return {\n    required: REQUIRED_FIELD,\n    validate: () => {\n      if (firstValue !== secondValue) {\n        return 'Пароли должны совпадать';\n      }\n      return true;\n    }\n  };\n};","map":{"version":3,"names":["REQUIRED_FIELD","reg","emailValidation","required","validate","value","length","test","nicknameValidation","nicknameChangeValidation","passwordValidation","confirmPassword","firstValue","secondValue"],"sources":["/data/messenger.client/src/modules/validation.ts"],"sourcesContent":["export const REQUIRED_FIELD = 'Обязательно для заполнения';\n\nconst reg = /\\.[a-zа-я]{1,10}$/i;\n\nexport const emailValidation = {\n    required: REQUIRED_FIELD,\n    validate: (value: string) => {\n        if (value.length < 4 || value.length > 128) {\n            return 'Эл. адрес должен быть от 4 до 128 символов'\n        }\n\n        if (!reg.test(value)) {\n            return 'Эл. адрес должен иметь тип: \"example@example.com\"'\n        }\n\n        return true;\n    }\n};\n\nexport const nicknameValidation = {\n    required: REQUIRED_FIELD,\n    validate: (value: string) => {\n        if (value.length < 2 || value.length > 30) {\n            return 'Псевдоним должен быть от 2 до 30 символов'\n        }\n\n        return true;\n    }\n};\n\nexport const nicknameChangeValidation = {\n    validate: (value: string | null | undefined) => {\n        if (value) {\n            if (value && value.length !== 0 || value.length < 2 || value.length > 30) {\n                return 'Псевдоним должен быть от 2 до 30 символов'\n            }\n        }\n\n        return true;\n    }\n};\n\nexport const passwordValidation = {\n    required: REQUIRED_FIELD,\n    validate: (value: string) => {\n        if (value.length < 8) {\n            return 'Пароль должен быть длиннее 8 символов'\n        }\n\n        return true;\n    }\n};\n\nexport const confirmPassword = (firstValue: string, secondValue: string) => {\n    return {\n        required: REQUIRED_FIELD,\n        validate: () => {\n            if (firstValue !== secondValue) {\n                return 'Пароли должны совпадать';\n            }\n        return true;\n    }\n    }\n};\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG,4BAA4B;AAE1D,MAAMC,GAAG,GAAG,oBAAoB;AAEhC,OAAO,MAAMC,eAAe,GAAG;EAC3BC,QAAQ,EAAEH,cAAc;EACxBI,QAAQ,EAAGC,KAAa,IAAK;IACzB,IAAIA,KAAK,CAACC,MAAM,GAAG,CAAC,IAAID,KAAK,CAACC,MAAM,GAAG,GAAG,EAAE;MACxC,OAAO,4CAA4C;IACvD;IAEA,IAAI,CAACL,GAAG,CAACM,IAAI,CAACF,KAAK,CAAC,EAAE;MAClB,OAAO,mDAAmD;IAC9D;IAEA,OAAO,IAAI;EACf;AACJ,CAAC;AAED,OAAO,MAAMG,kBAAkB,GAAG;EAC9BL,QAAQ,EAAEH,cAAc;EACxBI,QAAQ,EAAGC,KAAa,IAAK;IACzB,IAAIA,KAAK,CAACC,MAAM,GAAG,CAAC,IAAID,KAAK,CAACC,MAAM,GAAG,EAAE,EAAE;MACvC,OAAO,2CAA2C;IACtD;IAEA,OAAO,IAAI;EACf;AACJ,CAAC;AAED,OAAO,MAAMG,wBAAwB,GAAG;EACpCL,QAAQ,EAAGC,KAAgC,IAA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